package xyz.xtt.admin.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import xyz.xtt.admin.request.AssetTransactionListRequest;
import xyz.xtt.admin.service.IAssetTransactionService;
import xyz.xtt.admin.utils.PageUtilV2;
import xyz.xtt.admin.vo.AssetTransactionVo;
import xyz.xtt.common.response.ApiResult;

/**
 * <p>
 * 资产交易记录表 前端控制器
 * </p>
 *
 * @author author
 * @since 2024-12-03
 */
@RestController
@RequestMapping("/api/admin/asset_transaction")
public class AssetTransactionController {
    @Autowired
    private IAssetTransactionService assetTransactionService;
    @Autowired
    private PageUtilV2 pageUtil;

    @GetMapping("/list")
    public ApiResult< Page<AssetTransactionVo>> list(AssetTransactionListRequest assetTransactionListRequest) {
        Integer current = pageUtil.getCurrent(assetTransactionListRequest.getCurrent());
        assetTransactionListRequest.setCurrent(current);
        Integer pageSize = pageUtil.getPageSize(assetTransactionListRequest.getPageSize());
        assetTransactionListRequest.setPageSize(pageSize);
        return  ApiResult.ok(assetTransactionService.list(assetTransactionListRequest));
    }
}
